// 下拉框组件数据源请求方法
import api from '@/api/apiUrl'

export async function getSupplyList (params) {
    try {
        //获取供水区域
        let res = await api.SupplyType.getTreeList({ ...params })
        return res.data.result
    } catch (e) {
        console.log(e)
    }
}

// 获取组织下拉
export async function getAllDepartList (params) {
    try {
        //获取供水区域
        let res = await api.Department.getTreeList({ ...params })
        return res.data.result
    } catch (e) {
        console.log(e)
    }
}


export async function getRoleList (params) {
    try {
        //获取所有角色
        let res = await api.Role.getTreeList({ ...params })
        return res.data.result
    } catch (e) {
        console.log(e)
    }
}

export async function getVillageList (params) {
    try {
        //获取所有小区
        let res = await api.Village.getTreeList({ ...params })
        return res.data.result
    } catch (e) {
        console.log(e)
    }
}

export async function getEquiList (params) {
    try {
        //获取所有产品
        let res = await api.Device.getTreeList({ ...params })
        return res.data.result
    } catch (e) {
        console.log(e)
    }
}

export async function getTemplateList (params) {
    try {
        //获取所有模板
        let res = await api.Template.getTreeList({ ...params })
        return res.data.result
    } catch (e) {
        console.log(e)
    }
}

export async function getCountryList (params) {
    try {
        //获取国家列表
        let res = await api.PublicDataDictionary.getSelectItem({ groupCode: 1, ...params })
        return res.data.result
    } catch (e) {
        console.log(e)
    }
}

export async function getProjectList (params) {
    try {
        //获取项目列表
        let res = await api.Project.getTreeList({  ...params })
        return res.data.result
    } catch (e) {
        console.log(e)
    }
}

export async function getUserList (params) {
    try {
        //获取员工列表
        let res = await api.User.getTreeList({  ...params })
        return res.data.result
    } catch (e) {
        console.log(e)
    }
}

export async function getAreaList (params) {
    try {
        //获取运营区域列表
        let res = await api.Company.getTreeList({  ...params })
        return res.data.result
    } catch (e) {
        console.log(e)
    }
}

export async function getPumpList (params) {
    try {
        //获取泵房列表
        let res = await api.Project.getPumpTreeList({  ...params })
        return res.data.result
    } catch (e) {
        console.log(e)
    }
}

export async function getCategory (params) {
    try {
        //获取设备类型下拉
        let res = await api.DeviceCategory.getTreeList({  ...params })
        return res.data.result
    } catch (e) {
        console.log(e)
    }
}

export async function getCompanyTreeList (params) {
    try {
        //获取公司下拉
        let res = await api.Company.getCompanyTreeList({  ...params })
        return res.data.result
    } catch (e) {
        console.log(e)
    }
}
